"use strict";
//function 函数名（参数：类型）：函数返回值类型{}
function fn() { }
function fn1(name) {
    return name;
}
console.log(fn1('杰哥哥'));
function fn2(name) {
    return 1;
}
//箭头函数
var fn3 = function (name) {
    return true;
};
//形参默认值
var fn4 = function (name, age) {
    if (age === void 0) { age = 18; }
    console.log(name, age);
};
fn4('123', 2);
fn4('123');
//可选参数
var fn5 = function (name, age, sex) {
    if (age === void 0) { age = 18; }
    console.log(name, age);
};
fn5('123', 22, true);
fn5('123', 22);
//剩余参数
var fn6 = function () {
    var res = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        res[_i] = arguments[_i];
    }
    var count = 0;
    for (var i = 0; i < res.length; i++) {
        count += res[i];
    }
    return count;
};
console.log(fn6(1, 2, 3, 4, 5));
